﻿using DataCenter.Entitys;
using DataCenter.Service.Interfaces;
using Microsoft.AspNetCore.Mvc;
using System.Data;

namespace DataCenter.App.Controllers
{
    [ApiController]
    [Route("api/[controller]")]
    public class CustomerController : ControllerBase
    {
        private readonly ICustomerService customerService;
        public CustomerController(ICustomerService cService)
        {
            customerService = cService;
        }
        [HttpGet("all")]
        public async Task<IActionResult> All()
        {
            var datas = await customerService.GetAll();
            return Ok(datas);
        }
        [HttpGet(nameof(GetById))]
        public async Task<IActionResult> GetById([FromQuery]string id)
        {
           var data=  await customerService.GetById(Guid.Parse(id));
            return Ok(data);
        }
    }
}
